package com.daohang361.imqq.ui.img;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;

import com.daohang361.imqq.resourse.ResourcesManagement;

/**
 * 
 * 绘画登入界面的类 
 */
public class Imagecanvas extends Canvas {
	
	private String imagePath;
	private int width;
	private int higth;
	Toolkit tool;
	Image myimage;

	/**
	 * 
	 * @param imagePath:图片名字
	 * @param width:宽
	 * @param higth:高
	 */
	public Imagecanvas(String imagePath, int width, int higth) {
		this.imagePath = imagePath;
		this.width = width;
		this.higth = higth;

		setSize(width, higth);
		tool = getToolkit();
		java.net.URL iUrl = ResourcesManagement.class.getResource(imagePath);
		javax.swing.ImageIcon icon = new javax.swing.ImageIcon(iUrl);
		myimage = icon.getImage();
	}

	public void paint(Graphics g) {
		g.drawImage(myimage, 0, 0, width, higth, this);
	}

}
